package com.time.sky.controller;

import com.time.sky.entity.OBM;
import com.time.sky.mapper.OBMMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/OBM")
public class OBMController {
    @Autowired
    private OBMMapper obmMapper;
    @ResponseBody
    @RequestMapping("/select")
    public List<OBM> selectList(){   return obmMapper.selectList(); }
    @RequestMapping("/add")
    public void add(OBM obm){
        obmMapper.add(obm);
    }
    @RequestMapping("/delete/{oid}")
    public void delete(@PathVariable("oid") int oid){
        obmMapper.delete(oid);
    }
    @RequestMapping("/get/{oid}")
    public OBM getById(@PathVariable("oid") int oid){ return obmMapper.getById(oid); }
    @RequestMapping("/update")
    public void update(OBM obm){
        obmMapper.update(obm);
    }
    @RequestMapping("/rows")
    public int rows(){
        return obmMapper.getRowCount();
    }
}
